<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class AddIpBlacklist extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('ip_blacklist', function (Blueprint $table) {
            $table->increments('id');
            $table->char('client_ip', 20)->comment('IP地址');
            $table->timestamps();
            $table->tinyInteger('flag')->default(1)->comment('状态:1-冻结，0-解冻');
            $table->index('client_ip', 'client_ip');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('ip_blacklist');
    }
}
